document.addEventListener('DOMContentLoaded', () => {
    let startX = 0;
    let currentX = 0;

    document.addEventListener('touchstart', (e) => {
        startX = e.touches[0].clientX;
    });

    document.addEventListener('touchmove', (e) => {
        currentX = e.touches[0].clientX;
    });

    document.addEventListener('touchend', () => {
        const deltaX = currentX - startX;

        if (Math.abs(deltaX) > 50) { // 设置一个阈值来判断是否滑动
            if (deltaX < 0 && window.location.pathname === "/screen_situation/screen_situation/index.html") { // 向右滑动
                window.location.href = './index_Two.html';
            } else if (deltaX > 0 && window.location.pathname === "/screen_situation/screen_situation/index_Two.html") { // 向左滑动
                window.location.href = './index.html';
            }
        }
    });
});